home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Random Numbers Help Needed
- Date: 8 Feb 1996 18:40:45 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4fdg3d$n24@sparcserver.lrz-muenchen.de>
- References: <4facsd$lch@bagan.srce.hr>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- ov30801@tilia.cc.fer.hr (oliver-marin vidovic) writes:
-
-
- > Hi! I have a problem involving random number generator.
- > In my program I need a list of random numbers, but I don't want
- >them to be the same every time I start the program. Now, I know I
- >have to change the seed by srand function, but if I put the argument
- >to be constant, then srand is of no use. Therefore, i came to conclusion
- >that i have to make the argument of srand every time different.
- > So, my idea was to use the computer clock somehow, and to take
- >time as the seed, since that can hardly be the same every time I
- >start the program. But, there is something wrong when I try to make
- >something with functions from time.h.
- >(maybe I don't use them in right way, or maybe the whole idea is wrong)
-
- The idea is quite good, so it must be the way you use time().
-
- >Is there someone who can help me?!
-
- Probably, yes, but probably not without seeing the source of your
- atempt to seed the random number generator.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-